class Solution {
public:
    bool isBalanced(string num)
    {
        int odd = 0, even = 0;
        int x = 1;
        for (auto e : num)
        {
            if (x) even += e - '0';
            else odd += e - '0';
            x ^= 1;
        }
        return even == odd;
    }
};